﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<UncleBobWebService.Models.JobModel>" %>
<%@ Import Namespace="UncleBobApplicantWebService.Controllers" %>

<!DOCTYPE html>

<html>
    <head runat="server">
        <meta name="viewport" content="width=device-width" />

        <title>Create New Job</title>
        <link href="/Theme/UncleBobTheme.css" rel="Stylesheet" />
        <script lang="cs" runat=server>
            protected void Page_Load(Object obj, EventArgs e)
            {
                Label header = (Label)this.form1.FindControl("header");
                HtmlInputHidden isEditable = (HtmlInputHidden)this.form1.FindControl("isEditable");                
                HtmlInputText title = (HtmlInputText)this.form1.FindControl("txtTitle");
                HtmlInputText positions = (HtmlInputText)this.form1.FindControl("txtPositions");
                HtmlInputText location = (HtmlInputText)this.form1.FindControl("txtLocation");
                HtmlInputText salary = (HtmlInputText)this.form1.FindControl("txtSalary");
                HtmlTextArea description = (HtmlTextArea)this.form1.FindControl("txtDescription");
                HtmlInputSubmit b = (HtmlInputSubmit)this.form1.FindControl("cmdQuestions");
                
                if (Model != null)
                {
                    this.Title = "Edit Job";
                    header.Text = "Edit Job Information";
                    Session.Add(SessionKeys.ISEDIT, "Edit");
                                        
                    title.Value = Model.Title;
                    positions.Value = Model.PositionsAvailable.ToString();
                    location.Value = Model.Location;
                    salary.Value = Model.Salary;
                    description.Value = Model.Description;                    
                    b.Visible = true;
                }
                else
                {
                    this.Title = "Create New Job";
                    header.Text = "Create A New Job";                    
                    b.Visible = false;
                }
            }
        </script>     
        <style type="text/css">
            .style1
            {
                width: 35%;
                height: 26px;
            }
            .style2
            {
                width: 65%;
                height: 26px;
            }
        </style>
    </head>

    <body class="body">
        <form id="form1" runat="server" action="/StaffingExpertMenu/CreateJobFormAction">            
            <!-- Headers -->
            <asp:label id=header runat=server style="color: White; font-size:1.5em; font-weight: bold">Create New Job</asp:label>

            <!-- Job information input -->
            <div class=box >                
                <!-- Job Information -->
                <table class=table>
                    
                    <tr>
                        <td class="style1">                        
                            <label style="display: block; float: left">Job Title:</label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat=server
                                ControlToValidate=txtTitle
                                ErrorMessage="Title is required">*
                            </asp:RequiredFieldValidator>
                        </td>
                        <td class="style2"><input type=text runat=server id=txtTitle style="width: 100%" /></td>
                    </tr>

                     <tr>
                        <td class="style1">                        
                            <label style="display: block; float: left">Positions Available:</label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat=server
                                ControlToValidate=txtPositions
                                ErrorMessage="Positions Available is required">*
                            </asp:RequiredFieldValidator>
                        </td>
                        <td class="style2"><input type=text runat=server id=txtPositions 
                                style="width: 100%" /></td>
                    </tr>

                    <tr>
                        <td style="width: 35%">                        
                            <label style="display: block; float: left">Job Location:</label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat=server
                                ControlToValidate=txtLocation
                                ErrorMessage="Title is required">*
                            </asp:RequiredFieldValidator>
                        </td>
                        <td style="width: 65%"><input type=text runat=server id=txtLocation style="width: 100%" /></td>
                    </tr>

                    <tr>
                        <td style="width: 35%">
                            <label style="display: block; float: left">Job Salary:</label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat=server
                                ControlToValidate=txtSalary
                                ErrorMessage="Salary is required">*
                            </asp:RequiredFieldValidator>
                        </td>
                        <td style="width: 65%"><input type=text runat=server id=txtSalary style="width: 100%" /></td>
                    </tr>

                    <tr>
                        <td style="width: 35%">                        
                            <label style="display: block; float: left">Job Description:</label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat=server
                                ControlToValidate=txtDescription
                                ErrorMessage="Description is required ">*
                            </asp:RequiredFieldValidator>
                        </td>                   
                    </tr>
                </table>
                      
                <!-- Job Description -->
                <div style="margin-top: 10px">
                    <textarea id=txtDescription runat=server rows=20 cols=64 ></textarea>
                </div>
                <br />
                <input id=cmdQuestions class=button type=submit runat=server value="Questions" />
            </div>

            <!-- Buttons -->
            <div style="margin-top: 30px" >                
                <input id=cmdSubmit class=button type=submit runat=server value="Submit" />
                <input id=cmdCancel class=button type=submit name=cancel value="Cancel" />
            </div>

            <!-- Error summary -->
            <br />
            <div class="content" >
                <asp:ValidationSummary ID="ValidationSummary1" runat=server
                    HeaderText="There were errors on the page:" />
            </div>
        </form>             
    </body>
</html>
